﻿using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CafeOnline.MvcFramework.Grid {
    public class GridData {
        public class GridColumnData {
            public string Label { get; set; }
            public string Name { get; set; }
            public ColumnType ColumnType { get; set; }
        }
        public string Name { get; set; }
        public IEnumerable<GridColumnData> ColumnsNames { get; private set; }
        public IEnumerable<ExpandoObject> Data { get; private set; }
        public GridData(string gridName, IEnumerable<Column> columns, IEnumerable<ExpandoObject> rows) {
            ColumnsNames = columns.Where(x => x.Factory != null)
                                    .Select(t => new GridColumnData { Label = t.Label, Name = t.ColumnName, ColumnType = t.Factory.ColumnType });
        }
    }
}
